<html>
<head><meta charset="utf-8"><title>rustwide analysis-stats · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html">rustwide analysis-stats</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228064306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228064306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228064306">(Feb 27 2021 at 15:21)</a>:</h4>
<p>It might be a fun project to run the RA analysis over a set of popular Rust repost on GitHub to find any crashes/hangs. But we might as wall wait until <code>chalk</code> is tested in <code>rustc</code></p>



<a name="228064363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228064363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228064363">(Feb 27 2021 at 15:22)</a>:</h4>
<p>rust-craterizer?</p>



<a name="228064447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228064447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228064447">(Feb 27 2021 at 15:24)</a>:</h4>
<p>We still need to get all rustc tests green for Chalk integration</p>



<a name="228064495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228064495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228064495">(Feb 27 2021 at 15:24)</a>:</h4>
<p>But after that, yeah that's a good way to find issues</p>



<a name="228065070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228065070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228065070">(Feb 27 2021 at 15:35)</a>:</h4>
<p>Note that a good first step would be not crashing with <code>rust-analyzer analysis-stats --parallel --with-deps .</code> on parity's substrate</p>



<a name="228065112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228065112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228065112">(Feb 27 2021 at 15:36)</a>:</h4>
<p>Currently dies with</p>
<div class="codehilite"><pre><span></span><code>thread &#39;&lt;unnamed&gt;&#39; panicked at &#39;index out of bounds: the len is 1 but the index is 4&#39;, crates/hir_def/src/visibility.rs:170:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:69:5
   3: hir_def::visibility::Visibility::max
   4: hir_def::nameres::collector::DefCollector::update_recursive
   5: hir_def::nameres::collector::DefCollector::record_resolved_import
   6: hir_def::nameres::collector::DefCollector::resolve_imports
   7: hir_def::nameres::collector::collect_defs
   8: hir_def::nameres::DefMap::block_def_map_query
</code></pre></div>
<p>(cc <span class="user-mention" data-user-id="211727">@Jonas Schievink  [he/him]</span> )</p>



<a name="228065147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228065147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228065147">(Feb 27 2021 at 15:36)</a>:</h4>
<p>(visibility there reminrds me of that bug with macros)</p>



<a name="228073397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228073397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228073397">(Feb 27 2021 at 18:06)</a>:</h4>
<p>Repro:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">use</span><span class="w"> </span><span class="n">Tr</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">_</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">trait</span><span class="w"> </span><span class="n">Tr</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>...except it, again, doesn't happen when making this a test <span aria-label="angry cat" class="emoji emoji-1f63e" role="img" title="angry cat">:angry_cat:</span></p>



<a name="228073493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228073493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228073493">(Feb 27 2021 at 18:08)</a>:</h4>
<p>it would be neat if we could print query stacks during panic like rustc can</p>



<a name="228073792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228073792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228073792">(Feb 27 2021 at 18:13)</a>:</h4>
<p>That one doesn't panic for me</p>



<a name="228075359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228075359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228075359">(Feb 27 2021 at 18:42)</a>:</h4>
<p>oh lemme guess, only happens in submodules again</p>



<a name="228075381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228075381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228075381">(Feb 27 2021 at 18:42)</a>:</h4>
<p>yup</p>



<a name="228076160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228076160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228076160">(Feb 27 2021 at 18:58)</a>:</h4>
<p>what seems to happen is that the item's visibility gets resolved to the containing module, because we treat the default visibility as <code>pub(self)</code>, and <code>self</code> resolves to the containing module</p>



<a name="228076174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228076174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228076174">(Feb 27 2021 at 18:58)</a>:</h4>
<p><code>Visibility::max</code> does not handle visibilities from outside the given <code>DefMap</code> (which I think is correct) and panics</p>



<a name="228795532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228795532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228795532">(Mar 04 2021 at 15:46)</a>:</h4>
<p>The substrate codebase now runs into the chalk recurson limit:</p>
<div class="codehilite"><pre><span></span><code>thread &#39;&lt;unnamed&gt;&#39; panicked at &#39;overflow depth reached&#39;, /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-recursive-0.59.0/src/stack.rs:51:13
stack backtrace:
   0: std::panicking::begin_panic
   1: chalk_recursive::stack::Stack::push
   2: &lt;chalk_recursive::recursive::Solver&lt;I&gt; as chalk_recursive::solve::SolveDatabase&lt;I&gt;&gt;::solve_goal
   3: chalk_recursive::fulfill::Fulfill&lt;I,Solver&gt;::prove
   4: chalk_recursive::fulfill::Fulfill&lt;I,Solver&gt;::solve
</code></pre></div>
<p>It then pegs a core for hours while using 50 GB of RAM, it might be stuck in chalk or the type inference code:</p>
<div class="codehilite"><pre><span></span><code>(gdb) bt
#0  0x000056188c21f325 in &lt;salsa::derived::DerivedStorage&lt;Q,MP&gt; as salsa::plumbing::QueryStorageOps&lt;Q&gt;&gt;::try_fetch ()
#1  0x000056188c0c4e55 in &lt;DB as hir_ty::db::HirDatabase&gt;::trait_solve::__shim ()
#2  0x000056188ba8d8f9 in &lt;DB as hir_ty::db::HirDatabase&gt;::trait_solve ()
#3  0x000056188c18b705 in hir_ty::infer::InferenceContext::resolve_ty_as_possible::hdcbd7f0297ba5860 ()
#4  0x000056188c082eab in hir_ty::infer::unify::Canonicalized&lt;T&gt;::apply_solution ()
#5  0x000056188c18b925 in hir_ty::infer::InferenceContext::resolve_ty_as_possible::hdcbd7f0297ba5860 ()
#6  0x000056188c082eab in hir_ty::infer::unify::Canonicalized&lt;T&gt;::apply_solution ()
#7  0x000056188c18b925 in hir_ty::infer::InferenceContext::resolve_ty_as_possible::hdcbd7f0297ba5860 ()
#8  0x000056188c082eab in hir_ty::infer::unify::Canonicalized&lt;T&gt;::apply_solution ()
#9  0x000056188c18b925 in hir_ty::infer::InferenceContext::resolve_ty_as_possible::hdcbd7f0297ba5860 ()
#10 0x000056188c082eab in hir_ty::infer::unify::Canonicalized&lt;T&gt;::apply_solution ()
#11 0x000056188c18b925 in hir_ty::infer::InferenceContext::resolve_ty_as_possible::hdcbd7f0297ba5860 ()
#12 0x000056188c082eab in hir_ty::infer::unify::Canonicalized&lt;T&gt;::apply_solution ()
#13 0x000056188c18b925 in hir_ty::infer::InferenceContext::resolve_ty_as_possible::hdcbd7f0297ba5860 ()
#14 0x000056188c082eab in hir_ty::infer::unify::Canonicalized&lt;T&gt;::apply_solution ()
#15 0x000056188c18b925 in hir_ty::infer::InferenceContext::resolve_ty_as_possible::hdcbd7f0297ba5860 ()
#16 0x000056188c082eab in hir_ty::infer::unify::Canonicalized&lt;T&gt;::apply_solution ()
#17 0x000056188c18b925 in hir_ty::infer::InferenceContext::resolve_ty_as_possible::hdcbd7f0297ba5860 ()
#18 0x000056188c1791a7 in hir_ty::infer::path::&lt;impl hir_ty::infer::InferenceContext&gt;::infer_path ()
#19 0x000056188c17af73 in hir_ty::infer::expr::&lt;impl hir_ty::infer::InferenceContext&gt;::infer_expr_inner ()
#20 0x000056188c17b653 in hir_ty::infer::expr::&lt;impl hir_ty::infer::InferenceContext&gt;::infer_expr_inner ()
#21 0x000056188c179c15 in hir_ty::infer::expr::&lt;impl hir_ty::infer::InferenceContext&gt;::infer_expr ()
#22 0x000056188c17e6a1 in hir_ty::infer::expr::&lt;impl hir_ty::infer::InferenceContext&gt;::infer_expr_inner ()
</code></pre></div>



<a name="228795908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rustwide%20analysis-stats/near/228795908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rustwide.20analysis-stats.html#228795908">(Mar 04 2021 at 15:48)</a>:</h4>
<p>Should've used "stress testing trait inference" as an example of blockchain application on reddit</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>